#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1010;
typedef long long ll;
int a[N][N];
ll s[N][N],sum;
int main()
{
    int n, m, k = 0, l = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];

    for (int i = 1; i <= n; i = i + 2)
    {
        k++;
        for (int j = 1; j <= m; j = j + 2)
        {
            sum += a[i][j] + a[i][j + 1] + a[i + 1][j] + a[i + 1][j + 1];
            l++;
            s[k][l] = sum / 4;
            cout << s[k][l] << " ";
            sum = 0;
        }
        cout << endl;
    }
    return 0;
}